import request from "@/utils/request";

// 单个列表数据的类型限制
export interface CategoryInfoType {
    id: number,
    name: string,
    category1Id?: number,
    category2Id?: number
}

// 整体的列表数据类型限制
export type CategoryListType = CategoryInfoType[]

// 1- 获取一级列表的数据
export const reqGetCategory1ListAsync = () => {
    return request.get<null, CategoryListType>(`/admin/product/getCategory1`)
}

// 2- 获取二级列表的数据
export const reqGetCategory2ListAsync = (category1Id: number) => {
    return request.get<null, CategoryListType>(`/admin/product/getCategory2/${category1Id}`)
}

// 3- 获取三级列表的数据
export const reqGetCategory3ListAsync = (category2Id: number) => {
    return request.get<null, CategoryListType>(`/admin/product/getCategory3/${category2Id}`)
}

